<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Module</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Module</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/vendor/rails/railties/lib/console_with_helpers_rb.html">
                vendor/rails/railties/lib/console_with_helpers.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/module_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/module.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/module/attr_internal_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/module/delegation_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/module/delegation.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/module/inclusion_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/module/inclusion.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/module/loading_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/module/loading.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/module/synchronization_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/module/synchronization.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/deprecation_rb.html">
                vendor/rails/activesupport/lib/active_support/deprecation.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/vendor/builder-2_1_2/blankslate_rb.html">
                vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Also, modules included into <a href="Object.html">Object</a> need to be
scanned and have their instance methods removed from blank slate. In
theory, modules included into <a href="Kernel.html">Kernel</a> would have
to be removed as well, but a &quot;feature&quot; of Ruby prevents late
includes into modules from being exposed in the first place.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000088">append_features</a>&nbsp;&nbsp;
      <a href="#M000086">as_load_path</a>&nbsp;&nbsp;
      <a href="#M000076">attr_accessor_with_default</a>&nbsp;&nbsp;
      <a href="#M000080">attr_internal</a>&nbsp;&nbsp;
      <a href="#M000079">attr_internal_accessor</a>&nbsp;&nbsp;
      <a href="#M000077">attr_internal_reader</a>&nbsp;&nbsp;
      <a href="#M000078">attr_internal_writer</a>&nbsp;&nbsp;
      <a href="#M000084">delegate</a>&nbsp;&nbsp;
      <a href="#M000075">include_all_modules_from</a>&nbsp;&nbsp;
      <a href="#M000085">included_in_classes</a>&nbsp;&nbsp;
      <a href="#M000083">mattr_accessor</a>&nbsp;&nbsp;
      <a href="#M000081">mattr_reader</a>&nbsp;&nbsp;
      <a href="#M000082">mattr_writer</a>&nbsp;&nbsp;
      <a href="#M000087">synchronize</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="ActiveSupport/CoreExtensions/Module.html">ActiveSupport::CoreExtensions::Module</a></span>
        <span class="include-name">ActiveSupport::Deprecation::ClassMethods</span>
      </div>
    </div>

    <div id="section">



    <div id="aliases-list">
      <h3 class="section-bar">External Aliases</h3>

      <div class="name-list">
                        <table summary="aliases">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">append_features</td>
          <td>-&gt;</td>
          <td class="context-item-value">blankslate_original_append_features</td>
        </tr>
                        </table>
      </div>
    </div>


      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000088" class="method-detail">
        <a name="M000088"></a>

        <div class="method-heading">
          <a href="#M000088" class="method-signature">
          <span class="method-name">append_features</span><span class="method-args">(mod)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000088-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000088-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb, line 105</span>
105:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">append_features</span>(<span class="ruby-identifier">mod</span>)
106:     <span class="ruby-identifier">result</span> = <span class="ruby-identifier">blankslate_original_append_features</span>(<span class="ruby-identifier">mod</span>)
107:     <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mod</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span>
108:     <span class="ruby-identifier">instance_methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span><span class="ruby-operator">|</span>
109:       <span class="ruby-constant">BlankSlate</span>.<span class="ruby-identifier">hide</span>(<span class="ruby-identifier">name</span>)
110:     <span class="ruby-keyword kw">end</span>
111:     <span class="ruby-identifier">result</span>
112:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000086" class="method-detail">
        <a name="M000086"></a>

        <div class="method-heading">
          <a href="#M000086" class="method-signature">
          <span class="method-name">as_load_path</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns String#underscore applied to the module name minus trailing
classes.
</p>
<pre>
  ActiveRecord.as_load_path               # =&gt; &quot;active_record&quot;
  ActiveRecord::Associations.as_load_path # =&gt; &quot;active_record/associations&quot;
  ActiveRecord::Base.as_load_path         # =&gt; &quot;active_record&quot; (Base is a class)
</pre>
<p>
The <a href="Kernel.html">Kernel</a> module gives an empty string by
definition.
</p>
<pre>
  Kernel.as_load_path # =&gt; &quot;&quot;
  Math.as_load_path   # =&gt; &quot;math&quot;
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000086-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000086-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/loading.rb, line 12</span>
12:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">as_load_path</span>
13:     <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Object</span> <span class="ruby-operator">||</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Kernel</span>
14:       <span class="ruby-value str">''</span>
15:     <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Class</span>
16:       <span class="ruby-identifier">parent</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">?</span> <span class="ruby-value str">''</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">as_load_path</span>
17:     <span class="ruby-keyword kw">else</span>
18:       <span class="ruby-identifier">name</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'::'</span>).<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">word</span><span class="ruby-operator">|</span>
19:         <span class="ruby-identifier">word</span>.<span class="ruby-identifier">underscore</span>
20:       <span class="ruby-keyword kw">end</span> <span class="ruby-operator">*</span> <span class="ruby-value str">'/'</span>
21:     <span class="ruby-keyword kw">end</span>
22:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000076" class="method-detail">
        <a name="M000076"></a>

        <div class="method-heading">
          <a href="#M000076" class="method-signature">
          <span class="method-name">attr_accessor_with_default</span><span class="method-args">(sym, default = nil, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Declare an attribute accessor with an initial default return value.
</p>
<p>
To give attribute <tt>:age</tt> the initial value <tt>25</tt>:
</p>
<pre>
  class Person
    attr_accessor_with_default :age, 25
  end

  some_person.age
  =&gt; 25
  some_person.age = 26
  some_person.age
  =&gt; 26
</pre>
<p>
To give attribute <tt>:element_name</tt> a dynamic default value, evaluated
in scope of self:
</p>
<pre>
  attr_accessor_with_default(:element_name) { name.underscore }
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000076-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000076-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb, line 21</span>
21:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attr_accessor_with_default</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">default</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
22:     <span class="ruby-identifier">raise</span> <span class="ruby-value str">'Default value or block required'</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-operator">!</span><span class="ruby-identifier">default</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">block</span>
23:     <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">block_given?</span> <span class="ruby-value">? </span><span class="ruby-identifier">block</span> <span class="ruby-operator">:</span> <span class="ruby-constant">Proc</span>.<span class="ruby-identifier">new</span> { <span class="ruby-identifier">default</span> })
24:     <span class="ruby-identifier">module_eval</span>(<span class="ruby-value str">&quot;def \#{sym}=(value)\nclass &lt;&lt; self; attr_reader :\#{sym} end\n@\#{sym} = value\nend\n&quot;</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>)
25:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000080" class="method-detail">
        <a name="M000080"></a>

        <div class="method-heading">
          <span class="method-name">attr_internal</span><span class="method-args">(*attrs)</span>
        </div>
      
        <div class="method-description">
          <p>
Alias for <a href="Module.html#M000079">attr_internal_accessor</a>
</p>
        </div>
      </div>

      <div id="method-M000079" class="method-detail">
        <a name="M000079"></a>

        <div class="method-heading">
          <a href="#M000079" class="method-signature">
          <span class="method-name">attr_internal_accessor</span><span class="method-args">(*attrs)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Declares an attribute reader and writer backed by an internally-named
instance variable.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000079-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb, line 18</span>
18:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attr_internal_accessor</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">attrs</span>)
19:     <span class="ruby-identifier">attr_internal_reader</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">attrs</span>)
20:     <span class="ruby-identifier">attr_internal_writer</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">attrs</span>)
21:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000077" class="method-detail">
        <a name="M000077"></a>

        <div class="method-heading">
          <a href="#M000077" class="method-signature">
          <span class="method-name">attr_internal_reader</span><span class="method-args">(*attrs)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Declares an attribute reader backed by an internally-named instance
variable.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000077-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000077-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb, line 3</span>
3:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attr_internal_reader</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">attrs</span>)
4:     <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attr</span><span class="ruby-operator">|</span>
5:       <span class="ruby-identifier">module_eval</span> <span class="ruby-node">&quot;def #{attr}() #{attr_internal_ivar_name(attr)} end&quot;</span>
6:     <span class="ruby-keyword kw">end</span>
7:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000078" class="method-detail">
        <a name="M000078"></a>

        <div class="method-heading">
          <a href="#M000078" class="method-signature">
          <span class="method-name">attr_internal_writer</span><span class="method-args">(*attrs)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Declares an attribute writer backed by an internally-named instance
variable.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000078-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/attr_internal.rb, line 10</span>
10:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">attr_internal_writer</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">attrs</span>)
11:     <span class="ruby-identifier">attrs</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">attr</span><span class="ruby-operator">|</span>
12:       <span class="ruby-identifier">module_eval</span> <span class="ruby-node">&quot;def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end&quot;</span>
13:     <span class="ruby-keyword kw">end</span>
14:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000084" class="method-detail">
        <a name="M000084"></a>

        <div class="method-heading">
          <a href="#M000084" class="method-signature">
          <span class="method-name">delegate</span><span class="method-args">(*methods)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Provides a <a href="Module.html#M000084">delegate</a> class method to
easily expose contained objects&#8217; methods as your own. Pass one or
more methods (specified as symbols or strings) and the name of the target
object as the final <tt>:to</tt> option (also a symbol or string). At least
one method and the <tt>:to</tt> option are required.
</p>
<p>
Delegation is particularly useful with Active Record associations:
</p>
<pre>
  class Greeter &lt; ActiveRecord::Base
    def hello()   &quot;hello&quot;   end
    def goodbye() &quot;goodbye&quot; end
  end

  class Foo &lt; ActiveRecord::Base
    belongs_to :greeter
    delegate :hello, :to =&gt; :greeter
  end

  Foo.new.hello   # =&gt; &quot;hello&quot;
  Foo.new.goodbye # =&gt; NoMethodError: undefined method `goodbye' for #&lt;Foo:0x1af30c&gt;
</pre>
<p>
Multiple delegates to the same target are allowed:
</p>
<pre>
  class Foo &lt; ActiveRecord::Base
    belongs_to :greeter
    delegate :hello, :goodbye, :to =&gt; :greeter
  end

  Foo.new.goodbye # =&gt; &quot;goodbye&quot;
</pre>
<p>
Methods can be delegated to instance variables, class variables, or
constants by providing them as a symbols:
</p>
<pre>
  class Foo
    CONSTANT_ARRAY = [0,1,2,3]
    @@class_array  = [4,5,6,7]

    def initialize
      @instance_array = [8,9,10,11]
    end
    delegate :sum, :to =&gt; :CONSTANT_ARRAY
    delegate :min, :to =&gt; :@@class_array
    delegate :max, :to =&gt; :@instance_array
  end

  Foo.new.sum # =&gt; 6
  Foo.new.min # =&gt; 4
  Foo.new.max # =&gt; 11
</pre>
<p>
Delegates can optionally be prefixed using the <tt>:prefix</tt> option. If
the value is <tt>true</tt>, the <a href="Module.html#M000084">delegate</a>
methods are prefixed with the name of the object being delegated to.
</p>
<pre>
  Person = Struct.new(:name, :address)

  class Invoice &lt; Struct.new(:client)
    delegate :name, :address, :to =&gt; :client, :prefix =&gt; true
  end

  john_doe = Person.new(&quot;John Doe&quot;, &quot;Vimmersvej 13&quot;)
  invoice = Invoice.new(john_doe)
  invoice.client_name    # =&gt; &quot;John Doe&quot;
  invoice.client_address # =&gt; &quot;Vimmersvej 13&quot;
</pre>
<p>
It is also possible to supply a custom prefix.
</p>
<pre>
  class Invoice &lt; Struct.new(:client)
    delegate :name, :address, :to =&gt; :client, :prefix =&gt; :customer
  end

  invoice = Invoice.new(john_doe)
  invoice.customer_name    # =&gt; &quot;John Doe&quot;
  invoice.customer_address # =&gt; &quot;Vimmersvej 13&quot;
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000084-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/delegation.rb, line 75</span>
75:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delegate</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">methods</span>)
76:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">pop</span>
77:     <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">to</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:to</span>]
78:       <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, :to =&gt; :greeter).&quot;</span>
79:     <span class="ruby-keyword kw">end</span>
80: 
81:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:prefix</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:to</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/^[^a-z_]/</span>
82:       <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Can only automatically set the delegation prefix when delegating to a method.&quot;</span>
83:     <span class="ruby-keyword kw">end</span>
84: 
85:     <span class="ruby-identifier">prefix</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:prefix</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-node">&quot;#{options[:prefix] == true ? to : options[:prefix]}_&quot;</span>
86: 
87:     <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span>
88:       <span class="ruby-identifier">module_eval</span>(<span class="ruby-value str">&quot;def \#{prefix}\#{method}(*args, &amp;block)\n\#{to}.__send__(\#{method.inspect}, *args, &amp;block)\nend\n&quot;</span>, <span class="ruby-value str">&quot;(__DELEGATION__)&quot;</span>, <span class="ruby-value">1</span>)
89:     <span class="ruby-keyword kw">end</span>
90:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000075" class="method-detail">
        <a name="M000075"></a>

        <div class="method-heading">
          <a href="#M000075" class="method-signature">
          <span class="method-name">include_all_modules_from</span><span class="method-args">(parent_module)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000075-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000075-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/railties/lib/console_with_helpers.rb, line 2</span>
 2:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include_all_modules_from</span>(<span class="ruby-identifier">parent_module</span>)
 3:     <span class="ruby-identifier">parent_module</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">const</span><span class="ruby-operator">|</span>
 4:       <span class="ruby-identifier">mod</span> = <span class="ruby-identifier">parent_module</span>.<span class="ruby-identifier">const_get</span>(<span class="ruby-identifier">const</span>)
 5:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">mod</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Module</span>
 6:         <span class="ruby-identifier">send</span>(<span class="ruby-identifier">:include</span>, <span class="ruby-identifier">mod</span>)
 7:         <span class="ruby-identifier">include_all_modules_from</span>(<span class="ruby-identifier">mod</span>)
 8:       <span class="ruby-keyword kw">end</span>
 9:     <span class="ruby-keyword kw">end</span>
10:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000085" class="method-detail">
        <a name="M000085"></a>

        <div class="method-heading">
          <a href="#M000085" class="method-signature">
          <span class="method-name">included_in_classes</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns the classes in the current ObjectSpace where this module has been
mixed in according to Module#included_modules.
</p>
<pre>
  module M
  end

  module N
    include M
  end

  class C
    include M
  end

  class D &lt; C
  end

  p M.included_in_classes # =&gt; [C, D]
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000085-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000085-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/inclusion.rb, line 21</span>
21:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">included_in_classes</span>
22:     <span class="ruby-identifier">classes</span> = []
23:     <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span>(<span class="ruby-constant">Class</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">classes</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">k</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">included_modules</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-keyword kw">self</span>) }
24: 
25:     <span class="ruby-identifier">classes</span>.<span class="ruby-identifier">reverse</span>.<span class="ruby-identifier">inject</span>([]) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">unique_classes</span>, <span class="ruby-identifier">klass</span><span class="ruby-operator">|</span> 
26:       <span class="ruby-identifier">unique_classes</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">klass</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">unique_classes</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">to_s</span> }.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">klass</span>.<span class="ruby-identifier">to_s</span>)
27:       <span class="ruby-identifier">unique_classes</span>
28:     <span class="ruby-keyword kw">end</span>
29:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000083" class="method-detail">
        <a name="M000083"></a>

        <div class="method-heading">
          <a href="#M000083" class="method-signature">
          <span class="method-name">mattr_accessor</span><span class="method-args">(*syms)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000083-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb, line 56</span>
56:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mattr_accessor</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">syms</span>)
57:     <span class="ruby-identifier">mattr_reader</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">syms</span>)
58:     <span class="ruby-identifier">mattr_writer</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">syms</span>)
59:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000081" class="method-detail">
        <a name="M000081"></a>

        <div class="method-heading">
          <a href="#M000081" class="method-signature">
          <span class="method-name">mattr_reader</span><span class="method-args">(*syms)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000081-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb, line 14</span>
14:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mattr_reader</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">syms</span>)
15:     <span class="ruby-identifier">syms</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span>
16:       <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sym</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>)
17:       <span class="ruby-identifier">class_eval</span>(<span class="ruby-value str">&quot;unless defined? @@\#{sym}\n@@\#{sym} = nil\nend\n\ndef self.\#{sym}\n@@\#{sym}\nend\n\ndef \#{sym}\n@@\#{sym}\nend\n&quot;</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>)
18:     <span class="ruby-keyword kw">end</span>
19:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000082" class="method-detail">
        <a name="M000082"></a>

        <div class="method-heading">
          <a href="#M000082" class="method-signature">
          <span class="method-name">mattr_writer</span><span class="method-args">(*syms)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000082-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb, line 34</span>
34:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mattr_writer</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">syms</span>)
35:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">syms</span>.<span class="ruby-identifier">extract_options!</span>
36:     <span class="ruby-identifier">syms</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">sym</span><span class="ruby-operator">|</span>
37:       <span class="ruby-identifier">class_eval</span>(<span class="ruby-value str">&quot;unless defined? @@\#{sym}\n@@\#{sym} = nil\nend\n\ndef self.\#{sym}=(obj)\n@@\#{sym} = obj\nend\n\n\#{\&quot;\ndef \#{sym}=(obj)\n@@\#{sym} = obj\nend\n\&quot; unless options[:instance_writer] == false }\n&quot;</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>)
38:     <span class="ruby-keyword kw">end</span>
39:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000087" class="method-detail">
        <a name="M000087"></a>

        <div class="method-heading">
          <a href="#M000087" class="method-signature">
          <span class="method-name">synchronize</span><span class="method-args">(*methods)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Synchronize access around a method, delegating synchronization to a
particular mutex. A mutex (either a Mutex, or any object that responds to
<a href="Module.html#M000087">synchronize</a> and yields to a block) must
be provided as a final :with option. The :with option should be a symbol or
string, and can represent a method, constant, or instance or class
variable. Example:
</p>
<pre>
  class SharedCache
    @@lock = Mutex.new
    def expire
      ...
    end
    synchronize :expire, :with =&gt; :@@lock
  end
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000087-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000087-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/module/synchronization.rb, line 15</span>
15:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">synchronize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">methods</span>)
16:     <span class="ruby-identifier">options</span> = <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">extract_options!</span>
17:     <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Hash</span>) <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">with</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:with</span>]
18:       <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">&quot;Synchronization needs a mutex. Supply an options hash with a :with key as the last argument (e.g. synchronize :hello, :with =&gt; :@mutex).&quot;</span>
19:     <span class="ruby-keyword kw">end</span>
20: 
21:     <span class="ruby-identifier">methods</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method</span><span class="ruby-operator">|</span>
22:       <span class="ruby-identifier">aliased_method</span>, <span class="ruby-identifier">punctuation</span> = <span class="ruby-identifier">method</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/([?!=])$/</span>, <span class="ruby-value str">''</span>), <span class="ruby-identifier">$1</span>
23: 
24:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">method_defined?</span>(<span class="ruby-node">&quot;#{aliased_method}_without_synchronization#{punctuation}&quot;</span>)
25:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;#{method} is already synchronized. Double synchronization is not currently supported.&quot;</span>
26:       <span class="ruby-keyword kw">end</span>
27: 
28:       <span class="ruby-identifier">module_eval</span>(<span class="ruby-value str">&quot;def \#{aliased_method}_with_synchronization\#{punctuation}(*args, &amp;block)\n\#{with}.synchronize do\n\#{aliased_method}_without_synchronization\#{punctuation}(*args, &amp;block)\nend\nend\n&quot;</span>, <span class="ruby-keyword kw">__FILE__</span>, <span class="ruby-keyword kw">__LINE__</span>)
29: 
30:       <span class="ruby-identifier">alias_method_chain</span> <span class="ruby-identifier">method</span>, <span class="ruby-identifier">:synchronization</span>
31:     <span class="ruby-keyword kw">end</span>
32:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>